package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("note.txt");
        Scanner scan = new Scanner(System.in);
        System.out.println("开始输入内容");
        String line ;
        while (!("exit".equals(line=scan.nextLine()))){
           fos.write(line.getBytes(StandardCharsets.UTF_8));
        }


        /* while (true){
            String line = scan.nextLine();
            if ("exit".equalsIgnoreCase(line)){
                break;
            }
            fos.write(line.getBytes(StandardCharsets.UTF_8));
        }*/
        System.out.println("结束");
        fos.close();
    }
}
